<template>
  <div class="index_hotal">
    <div class="main_hot common">
      <p class="titleall">热门话题</p>
      <p class="entit">Hot topic</p>
      <div v-if="mainData[0]" class="cont">
        <div v-for="(item, index) in mainData[0]" :key="index" class="hot_box">
          <dl @mouseout="seout(9)" @mouseover="hover(index)">
            <dt><img :src="item.image" alt="" style="height: inherit" /></dt>
            <dd v-show="shows == index">
              <p>{{ item.title }}</p>
              \
            </dd>
          </dl>
        </div>
      </div>
      <div v-else class="noData">暂无数据</div>
    </div>
    <div class="main_case common">
      <p class="titleall">优秀案例</p>
      <p class="entit">Excellent Case</p>
      <div v-if="mainData[1]" class="swiper1">
        <swiper
          ref="mySwiper"
          :not-next-tick="notNextTick"
          :options="swiperOption"
        >
          <div
            v-for="(item, index) in mainData[1]"
            :key="index"
            class="swiper-slide swiper1lide"
          >
            <div class="swimg">
              <img :src="item.image" alt="" />
            </div>
          </div>
          <!-- Add Arrows -->
          <div slot="button-prev" class="swiper-button-prev prev1"></div>
          <div slot="button-next" class="swiper-button-next next1"></div>
        </swiper>

        <p class="link" style="cursor: pointer">
          <span>查看更多</span>
        </p>
      </div>
      <div v-else class="noData">暂无数据</div>
    </div>
  </div>
</template>

<script>
// import Swiper from "swiper";
export default {
  name: "HelloWorld",
  props: {
    msg: String,
    mainData: Array,
  },
  data() {
    return {
      notNextTick: true,
      swiperOption: {
        slidesPerView: 3,
        spaceBetween: 30,
        slidesPerGroup: 3,
        loop: true,
        loopFillGroupWithBlank: true,
        prevButton: ".swiper-button-prev",
        nextButton: ".swiper-button-next",
      },
    };
  },
  methods: {
    // 话题
    hover(a) {
      this.shows = a;
    },
    seout(a) {
      this.shows = a;
    },
    // 话题 end

    // 案例
  },
  created() {},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
// swiper
.swimg {
  width: 300px;
  height: 400px;
  margin: 0 auto;
  transition: all 0.6s;
}

.swiper1lide {
  text-align: center;
  padding: 52px 0 20px 0;
}

.swiper1lide img {
  width: 100%;
  height: inherit;
  //object-fit: contain;
}

.swiper1lide .swimg:hover {
  transform: scale(1.02);
  box-shadow: 3px 3px 20px #888888;
}

.swiper-button-prev:after,
.swiper-button-next:after {
  display: none;
}

.swiper-button-prev,
.swiper-button-next {
  width: 42px;
  height: 42px;
  background: #e0e0e0;
  border-radius: 42px;
}

.swiper-button-prev {
  background: url(../assets/fan1.png) no-repeat center #e0e0e0;
}

.swiper-button-next {
  background: url(../assets/fan2.png) no-repeat center #e0e0e0;
}

.swiper-container {
  width: 95%;
  margin: 0 auto;
  padding: 0 2.5%;
}

// swiper end

.index_hotal {
  // 热门话题
  .main_hot {
    margin: 0 auto;
    // border: 1px solid red;
    background: #f7f8fa;
    padding: 59px 5px 85px 5px;

    .title {
      text-align: center;
      font-size: 28px;
    }

    .entit {
      text-align: center;
      color: #999;
      padding: 10px 0;
      font-size: 18px;
    }

    .cont {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      margin-top: 20px;

      .hot_box {
        // border: 1px solid red;
        width: 274px;
        height: 196px;
        border-radius: 5px;
        transition: all 0.6s;
        margin-top: 20px;

        // 盒子样式每个
        dl {
          position: relative;
          cursor: pointer;

          dt {
            // border: 1px solid green;
            height: 196px;

            img {
              width: 100%;
            }
          }

          dd {
            height: 196px;
            position: absolute;
            left: 0;
            top: 0;
            background: rgba($color: #000000, $alpha: 0.5);
            width: 100%;
            border-radius: 5px;

            p {
              margin-top: 70px;
              // border: 1px solid red;
              text-align: center;
              font-size: 28px;
              font-weight: normal;
              color: #fff;
              line-height: 48px;
              z-index: 99999;
            }
          }
        }
      }

      // 放大
      .hot_box:hover {
        transform: scale(1.02);
      }
    }
  }

  // 优秀案例
  .main_case {
    margin: 20px auto;
    background: url(../assets/bg11.png) no-repeat;
    padding: 79px 0 30px 0;
    // border: 1px solid red;
    .title {
      text-align: center;
      font-size: 28px;
    }

    .entit {
      text-align: center;
      color: #999;
      padding: 10px 0;
      font-size: 18px;
    }

    .swiper1 {
      // border: 1px solid red;
      .link {
        margin-top: 50px;

        span {
          color: #fff;
          width: 214px;
          height: 58px;
          background: #33cfff;
          border-radius: 29px;
          display: block;
          margin: 0 auto;
          text-align: center;
          font-size: 20px;
          line-height: 58px;
        }
      }
    }
  }
}
</style>
